﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *  
 **/

using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Peter.Ruby.Tests
{
   /// <summary>
   /// Test cases for the rails project.
   /// </summary>
   [TestClass]
   public class RailsProjectTests
   {
      /// <summary>
      /// Test opening an invalid project
      /// </summary>
      [TestMethod]
      public void TestOpenInvalidProject ()
      {
         var project = new RailsProject ();
         Assert.IsFalse (project.Open ("SomeFakePath"));
         Assert.IsFalse (project.Open (null));
         Assert.IsFalse (project.Open (string.Empty));
      }

      /// <summary>
      /// Gets or Sets the mocked peter project.
      /// </summary>
      protected static MockPeterProject MockProject { get; set; }

      /// <summary>
      /// Gets the test context.
      /// </summary>
      protected static TestContext Context { get; private set; }

      /// <summary>
      /// Initializes the tests in this class.
      /// </summary>
      /// <param name="context">Test context</param>
      [ClassInitialize]
      public static void ClassInitialize (TestContext context)
      {
         Context = context;
         var assem = Assembly.GetExecutingAssembly ();
         MockProject = new MockPeterProject (assem, context.TestDir);
      }

      /// <summary>
      /// Cleans up the tests in this class.
      /// </summary>
      [ClassCleanup]
      public static void ClassCleanup ()
      {
         MockProject.Close (Context.TestDir);
      }
   }
}
